package com.schoolvisitors.vo;

import com.schoolvisitors.entity.Room;
import com.schoolvisitors.enums.RoomTypeEnum;
import lombok.Data;

import java.time.LocalTime;

@Data
public class ManageRoomVo {
    private Long id;
    private Long floorId;
    private String floorName;
    private RoomTypeEnum type;
    private String typeName;
    private Long number;
    private String subType;
    private Long capacity;
    private Boolean available;
    private Long pointsCost;
    private Short cubicleCount;
    private String img;
    private LocalTime openTime;
    private LocalTime closeTime;

    public static ManageRoomVo toVo(Room room) {
        ManageRoomVo vo = new ManageRoomVo();
        vo.setId(room.getId());
        vo.setFloorId(room.getFloor().getId());
        vo.setFloorName(room.getFloor().getName());
        vo.setTypeName(room.getType().getDesc());
        vo.setNumber(room.getNumber());
        vo.setSubType(room.getSubType());
        vo.setCapacity(room.getCapacity());
        vo.setAvailable(room.getAvailable());
        vo.setPointsCost(room.getPointsCost());
        vo.setCubicleCount(room.getCubicleCount());
        vo.setOpenTime(room.getOpenTime());
        vo.setCloseTime(room.getCloseTime());
        vo.setType(room.getType());
        vo.setImg(room.getImg());


        return vo;
    }
}
